//
//  YWReplyDBManager.h
//  maintain
//
//  Created by Kyo on 16/9/1.
//  Copyright © 2016年 ewin. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "YWSingleton.h"

@class YWReply;
@class FMResultSet;
@class FMDatabase;

@interface YWReplyDBManager : NSObject
YWSingletonH(Manager)

/**
 *  创建评论表
 *
 *  @return 结果
 */
- (BOOL)createReplyTable;

#pragma mark - public methods
/**
 *  保存更新评论
 *
 *  @param Replys 回复数组
 *
 *  @return 结果
 */
- (BOOL)updateReplyWithReplyArray:(NSArray*)replyArray;
/**
 *  更新评论的已读状态
 *
 *  @param relationType 类型
 *
 *  @return 结果
 */
- (BOOL)updateReplyIsReadWithType:(NSInteger)relationType;
/**
 *  删除评论
 *
 *  @param replyId 评论id
 *
 *  @return 结果
 */
- (BOOL)deleteReplyWithReplyId:(NSInteger)replyId;
/**
 *  获取某条数据的评论
 *
 *  @param relationId 关联id
 *
 *  @return 结果
 */
- (NSArray*)replysWithtRelationId:(NSInteger)relationId andRelationType:(NSInteger)relationType;
/**
 *  获取未读的评论
 *
 *  @param relationType 关联类型
 *
 *  @return 结果
 */
- (NSArray*)noReadReplysWithRelationType:(NSInteger)relationType;
/**
 *   查询未读的评论的数量
 *
 *  @param relationType 关联类型
 *
 *  @return 结果
 */
- (NSInteger)noReadReplysCountWithRelationType:(NSInteger)relationType;
/**
 *   查询关联的评论的数量
 *
 *  @param relationId 关联id
 *  @param relationType 关联类型
 *
 *  @return 结果
 */
- (NSInteger)replysCountWithtRelationId:(NSInteger)relationId relationType:(NSInteger)relationType;

- (YWReply*)replyWithFMResultSet:(FMResultSet*)set FMDatabase:(FMDatabase*)db;
@end
